import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/web/Home.vue";
import userInfo from "../views/web/userInfo.vue"
import videoList from "../views/web/videoList.vue";
import web from "../views/web/web.vue"
import product from '../views/web/product'
import videoInfo from "../views/web/videoInfo";
import test from '../views/web/test/test';
import backgrounds from "../views/web/test/backgrounds";
import slots from "../views/web/test/slots";
import wangeditor from "../views/web/test/wangeditor"
Vue.use(VueRouter);


const routes = [
  {
    path:'/',
    name:'web',
    component:web,
    redirect: "/home",
    children:[
      {
        path: "home",
        name: "Home",
        component: Home,
      },
      {
        path:'product',
        name:'product',
        component:product,
      },
      {
        path: "videoList",
        name: "videoList",
        component: videoList,
      },
      {
        path: "userInfo",
        name: "userInfo",
        component: userInfo,
      }
    ]
  },
  {
    name:'videoInfo',
    path:'/videoInfo',
    component:videoInfo,
  },
  {
    name:'test',
    path:'/test',
    component:test,
  },
  {
    name:'backgrounds',
    path:'/backgrounds',
    component:backgrounds,
  },
  {
    name:'slots',
    path:'/slots',
    component:slots,
  },
  {
    name:'wangeditor',
    path:'/wangeditor',
    component:wangeditor,
  },
];

const router = new VueRouter({
  routes,
});
router.beforeEach((to,from,next)=>{
  window.scrollTo(0,0);
  next();
})
export default router;
